<template>
  <div id="centerRight2">
    <div class="bg-color-black">
      <div class="d-flex pt-2 pl-2">
        <span>
          <icon name="align-left" class="text-icon"></icon>
        </span>
        <span class="fs-xl text mx-2">党员发展占比</span>
      </div>
      <div class="d-flex ai-center flex-column body-box">
        <dv-capsule-chart class="dv-cap-chart" :config="config" />
        <centerRight2Chart1 />
      </div>
    </div>
  </div>
</template>

<script>
import centerRight2Chart1 from '@/components/echart/centerRight/centerRightChart'
import { queryPartyMemberNum } from "../api/index.js";

export default {
  data() {
    return {
      config: {

        showValue: true,
        data: [
          {
            name: '正式党员',
            value: 167
          },
          {
            name: '预备党员',
            value: 67
          },
          {
            name: '发展对象',
            value: 123
          },
          {
            name: '积极分子',
            value: 55
          },
          {
            name: '团员',
            value: 98
          },
          {
            name: '群众',
            value: 98
          }
        ],
      }
    }
  },
  created() {
    this.getData()
  },
  methods: {
    getData() {
      let that = this;
      queryPartyMemberNum().then(res => {
        console.log(res)
        that.config.data[0].value = res.data.partyMember
        that.config.data[1].value = res.data.probationary
        that.config.data[2].value = res.data.development
        that.config.data[3].value = res.data.activists
        that.config.data[4].value = res.data.league
        that.config.data[5].value = res.data.crowd
        that.config = { ...that.config }
      })
    }
  },
  components: { centerRight2Chart1 }
}
</script>

<style lang="scss" scoped>
#centerRight2 {
  $box-height: 410px;
  $box-width: 340px;
  padding: 5px;
  height: $box-height;
  width: $box-width;
  border-radius: 5px;
  .bg-color-black {
    padding: 5px;
    height: $box-height;
    width: $box-width;
    border-radius: 10px;
  }
  .text {
    color: #c3cbde;
  }
  .body-box {
    border-radius: 10px;
    overflow: hidden;
    .dv-cap-chart {
      width: 100%;
      height: 160px;
    }
  }
}
</style>
